package com.cskaoyan.bean.wx.vo;

import com.cskaoyan.bean.BasePageData;
import com.cskaoyan.bean.Category;
import com.cskaoyan.bean.Goods;
import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

/**
 * @Author tangjian
 * @Date 2021/10/25 0:04
 * @description
 */
@Data
public class WxCommentPageData<T> {

    Integer limit;
    Integer page;
    Integer pages;
    Integer total;
    List<T> list;

    public static <T> WxCommentPageData ok(List<T> list) {
        PageInfo<T> pageInfo = new PageInfo<>(list);

        WxCommentPageData<T> basePageData = new WxCommentPageData<>();
        basePageData.setPage(pageInfo.getPageNum());
        basePageData.setLimit(pageInfo.getPageSize());
        basePageData.setPages(pageInfo.getPages());
        basePageData.setTotal((int) pageInfo.getTotal());
        basePageData.setList(list);

        return basePageData;
    }

}
